package com.example;

import com.example.beans.Product;
import com.example.beans.Student;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class App {
    public static void main(String[] args) {
        // 1. 加载Spring配置文件
        ApplicationContext context = 
            new ClassPathXmlApplicationContext("applicationContext.xml");
        
        // 2. 获取Bean实例
        Product product = context.getBean("product", Product.class);
        Student student = context.getBean("student", Student.class);
        
        // 3. 打印Bean信息
        System.out.println("----- Spring IOC容器中的Bean -----");
        System.out.println(product);
        System.out.println(student);
    }
}